package com.xmy.cultivate.mapper;

import com.xmy.cultivate.entity.PermissionSchoolTeacher;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 老师查看校区的功能权限【例：某个功能需要设置对应老师可以看哪些校区的数据】 Mapper 接口
 * </p>
 *
 * @author hpiggy
 * @since 2025-03-26
 */
public interface PermissionSchoolTeacherMapper extends BaseMapper<PermissionSchoolTeacher> {



    @Select("SELECT school_id FROM permission_school_teacher WHERE deleted = 0 AND type = 1 AND teacher_id = ${teacherId}")
    public List<String> getSchoolIdByTeacherId(@Param("teacherId") String teacherId);


    @Select("SELECT school_id FROM permission_school_teacher WHERE deleted = 0 AND type = 1 AND position_type = 2 AND teacher_id = ${teacherId}")
    public List<String> getManagerByTeacherId(@Param("teacherId") String teacherId);

    @Select("SELECT * FROM permission_school_teacher WHERE deleted = 0 AND type = 1 AND position_type = 3 AND teacher_id = ${teacherId}")
    public List<PermissionSchoolTeacher> getPermissionSchoolTeacherByTeacherId(@Param("teacherId") String teacherId);

}
